#  Copyright (C) 2005-2006 Sham Chukoury <eleusis@xmms.org>
#
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2.1 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.

import Chalyx
import mpdconnector
from PyQt4 import QtCore

class MPDQtConnector(mpdconnector.MPDConnector, QtCore.QObject):
	def __init__(self, mpd, pingInterval = 5, args = None):
		mpdconnector.MPDConnector.__init__(self, mpd, pingInterval, args)
		parent = args
		QtCore.QObject.__init__(self, parent)
		self.timerID = self.startTimer(self.statusTimeout)

	def stop(self):
		# called when disconnecting the service
		self.killTimer(self.timerID)
		return mpdconnector.MPDConnector.stop(self)

	def timerEvent(self, event):
		self.status_check()